package vn.mobiistar.videoapp.fragment;

import vn.mobiistar.videoapp.R;
import vn.mobiistar.videoapp.other.Define;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerSupportFragment;

public class SimpleVideoFragment extends Fragment{

	private String video_id;
	private YouTubePlayerSupportFragment mYoutubeFragment;
	private YouTubePlayer mYoutubePlayer;
	private boolean mIsInit;
	private static final String APPLICATION_RAW_PATH = "android.resource://vn.mobiistar.videoapp/";
	
	public SimpleVideoFragment(YouTubePlayerSupportFragment f){
		mYoutubeFragment = f;
	}
	public void setVideoId(String video_id) {
		this.video_id = video_id;
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreateView(inflater, container, savedInstanceState);
		View menuContent = inflater.inflate(R.layout.fragmentvideosample, null);
        if(!mIsInit) init();
		return menuContent;
	}
	public void init(){
		mIsInit = true;
		FragmentTransaction transaction = getFragmentManager().beginTransaction();
		transaction.replace(R.id.fragment_youtube, mYoutubeFragment);
		// Commit the transaction
		transaction.commit();
	}
	
	public void setmYoutubeFragment(
			YouTubePlayerSupportFragment mYoutubeFragment) {
		this.mYoutubeFragment = mYoutubeFragment;
	}
	public YouTubePlayerSupportFragment getmYoutubeFragment() {
		return mYoutubeFragment;
	}
	public void setmYoutubePlayer(YouTubePlayer mYoutubePlayer) {
		this.mYoutubePlayer = mYoutubePlayer;
	}
	public YouTubePlayer getmYoutubePlayer() {
		return mYoutubePlayer;
	}
	
}
